package cn.e4j.modular.crm.controller;

import cn.e4j.core.dto.impl.Dto;
import cn.e4j.core.dto.requestDtoResolver.DtoParam;
import cn.e4j.core.dto.requestDtoResolver.DtoWapper;
import cn.e4j.core.reqres.response.PageReData;
import cn.e4j.core.reqres.response.ResponseData;
import cn.e4j.modular.crm.service.Gwcq003Service;
import cn.e4j.modular.erp.controller.ErpLogic;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 车辆发车明细查询
 *
 * @author liuw
 * @Date 2019/12/24
 */
@Controller
@RequestMapping("/crm/gwcq003")
public class Gwcq003Controller {
    @Autowired
    private Gwcq003Service gwcq003Service;
    @Autowired
    private ErpLogic erpLogic;

    /**
     * 跳转页面
     */
    @RequiresPermissions("crm:gwcq003:init")
    @RequestMapping(value = {"", "init"})
    public String index() {
        return "/pc/crm/gwcq003.html";
    }

    /**
     * 查询列表数据
     */
    @RequestMapping("/getList")
    @RequiresPermissions("crm:gwcq003:init")
    @ResponseBody
    public ResponseData getList(@DtoParam DtoWapper dtoWapper) {
        Page<Object> page = dtoWapper.getPage();
        Dto inDto = dtoWapper.getDto();
        List<Dto> result = this.gwcq003Service.getList(page, inDto);
        return new PageReData(page, result);
    }
}
